Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
sender.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 Roc authors
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 */
8
9//! @file roc_pipeline/sender.h
10//! @brief Sender pipeline.
11
12#ifndef ROC_PIPELINE_SENDER_H_
13#define ROC_PIPELINE_SENDER_H_
14
20#include "roc_core/iallocator.h"
22#include "roc_core/ticker.h"
23#include "roc_core/unique_ptr.h"
24#include "roc_fec/codec_map.h"
26#include "roc_fec/writer.h"
29#include "roc_packet/router.h"
30#include "roc_pipeline/config.h"
32#include "roc_rtp/format_map.h"
33#include "roc_sndio/isink.h"
34
35namespace roc {
36namespace pipeline {
37
38//! Sender pipeline.
39class Sender : public sndio::ISink, public core::NonCopyable<> {
40public:
41 //! Initialize.
42 Sender(const SenderConfig& config,
43 const PortConfig& source_port,
44 packet::IWriter& source_writer,
45 const PortConfig& repair_port,
46 packet::IWriter& repair_writer,
47 const fec::CodecMap& codec_map,
48 const rtp::FormatMap& format_map,
49 packet::PacketPool& packet_pool,
50 core::BufferPool<uint8_t>& byte_buffer_pool,
51 core::BufferPool<audio::sample_t>& sample_buffer_pool,
52 core::IAllocator& allocator);
53
54 //! Check if the pipeline was successfully constructed.
55 bool valid();
56
57 //! Get sink sample rate.
58 virtual size_t sample_rate() const;
59
60 //! Check if the sink has own clock.
61 virtual bool has_clock() const;
62
63 //! Write audio frame.
64 virtual void write(audio::Frame& frame);
65
66private:
67 core::UniquePtr<SenderPort> source_port_;
68 core::UniquePtr<SenderPort> repair_port_;
69
71
73
76
79
80 core::UniquePtr<audio::PoisonWriter> resampler_poisoner_;
82
83 core::UniquePtr<audio::PoisonWriter> pipeline_poisoner_;
84
86
87 audio::IWriter* audio_writer_;
88
89 SenderConfig config_;
90
91 packet::timestamp_t timestamp_;
92 size_t num_channels_;
93};
94
95} // namespace pipeline
96} // namespace roc
97
98#endif // ROC_PIPELINE_SENDER_H_
Buffer pool.
Audio frame.
Definition: frame.h:22
Audio writer interface.
Definition: iwriter.h:21
Memory allocator interface.
Definition: iallocator.h:23
Base class for non-copyable objects.
Definition: noncopyable.h:23
Unique ownrship pointer.
Definition: unique_ptr.h:27
FEC codec map.
Definition: codec_map.h:26
Packet writer interface.
Definition: iwriter.h:21
Sender pipeline.
Definition: sender.h:39
virtual void write(audio::Frame &frame)
Write audio frame.
Sender(const SenderConfig &config, const PortConfig &source_port, packet::IWriter &source_writer, const PortConfig &repair_port, packet::IWriter &repair_writer, const fec::CodecMap &codec_map, const rtp::FormatMap &format_map, packet::PacketPool &packet_pool, core::BufferPool< uint8_t > &byte_buffer_pool, core::BufferPool< audio::sample_t > &sample_buffer_pool, core::IAllocator &allocator)
Initialize.
virtual size_t sample_rate() const
Get sink sample rate.
virtual bool has_clock() const
Check if the sink has own clock.
bool valid()
Check if the pipeline was successfully constructed.
RTP payload format map.
Definition: format_map.h:22
Sink interface.
Definition: isink.h:21
FEC codec map.
RTP payload format map.
Memory allocator interface.
FEC block encoder interface.
Audio frame encoder interface.
Interleaves packets before transmit.
Sink interface.
uint32_t timestamp_t
Audio packet timestamp.
Definition: units.h:46
Root namespace.
Non-copyable object.
Packet pool.
Packetizer.
Poison writer.
Pipeline config.
Route packets to writers.
Sender port pipeline.
Port parameters.
Definition: config.h:56
Sender parameters.
Definition: config.h:69
Ticker.
Unique ownrship pointer.
FEC writer.